/*
 * @Author: wangdazhuang
 * @Date: 2024-12-05 17:57:36
 * @LastEditTime: 2025-01-20 14:05:36
 * @LastEditors: wangdazhuang
 * @Description: 
 * @FilePath: /pornhub_app/lib/views/douyin/dou_yin_page_controller.dart
 */
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/views/douyin/short_video_player/controllers/short_video_player_page_controller.dart';

import 'short_video_player/common/short_v_p_cell_controller.dart';

class DouYinPageController extends GetxController
    with GetSingleTickerProviderStateMixin {
  static final tabs = ['关注', '推荐'];
  static const tabIndexFocus = 0;
  static const tabIndexRec = 1;
  late final TabController tabController;
  @override
  void onInit() {
    tabController = TabController(
      length: tabs.length,
      vsync: this,
      initialIndex: tabIndexRec,
    );
    _bindSubViewControllers();
    super.onInit();
  }

  void _bindSubViewControllers() {
    ///关注

    ///推荐
    const rcMode = ShortVideoPlayerMode.recommend;
    final rcTag = rcMode.index.toString();
    Get.lazyPut(() => ShortVideoPlayerPageController(mode: rcMode), tag: rcTag);
    Get.create(() => ShortVPCellController(mode: rcMode), tag: rcTag);
  }

  @override
  void onClose() {
    tabController.dispose();
    super.onClose();
  }
}
